package Tathy;

import java.awt.Graphics;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.io.IOException;

import javax.imageio.ImageIO;

import GameEngine.GameObject2D;

public class Cow extends GameObject2D{
	BufferedImage cow;
	public int cowVertical, cowHorizontal, contCow, contVaca = 0;
	
	public Cow() {
		super("");
		try{
			cow = ImageIO.read(getClass().getResource("cow.png"));
			
		}catch (IOException e) {
			e.printStackTrace();
		}
	}


	public void paint(Graphics g) {
		g.drawImage(cow.getSubimage(cow.getWidth()/3*contCow, cow.getHeight()/4*0, 
				cow.getWidth()/3,cow.getHeight()/4),cowHorizontal,cowVertical,null);
		
	}


	public void updateKeyEvent(KeyEvent keyevent) {
	contVaca++;
		if(contVaca <5 && contVaca < 10){
			contCow=1;
		}
		if(contVaca>10 && contVaca <15){
			contCow=2;
	}
		if(contVaca >15){
			contCow=0;
			contVaca=0;
					}
		//mudar
		if(contVaca<15){
			cowVertical++;
		}
	
		}
		
	


	public void updateMouseEvent(MouseEvent mouseevent) {
		
		
	}

}
